<template>
  <div class="login">
    <el-form
        ref="form"
        :model="dataForm"
        status-icon
        label-width="120px"
        class="demo-ruleForm"
    >
      <el-form-item label="用户名" prop="username">
        <el-input v-model="dataForm.username" autocomplete="off" />
      </el-form-item>
      <el-form-item label="密码" prop="password">
        <el-input
            v-model="dataForm.password"
            type="password"
            autocomplete="off"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm"
        >登陆</el-button
        >
        <el-button @click="resetForm">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup>
import {reactive, ref} from "vue";
import {useRouter} from 'vue-router'
const form = ref()
const router = useRouter()
const dataForm = reactive({
  username:"admin",
  password:"admin"
})

const submitForm = ()=>{
  router.push({
    path:'index'
  })
}

const resetForm = ()=>{
  form.value.resetFields()
}

</script>

<style scoped>
.login{
  display: flex;
  width: 400px;
  height: 400px;
  justify-content: center;
  align-items: center;
}
</style>
